<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>

<HEAD>


	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>


	<LINK href="styles.css" type="text/css" rel="stylesheet">

</HEAD>
<BODY class=Grad>
<h2 align=center>Employ Registration</h2>

<%

	Connection con=null;
	ResultSet rs=null;
	Statement stmt=null,stmt1=null;
	
		String userid = request.getParameter("userid");
		String password = request.getParameter("password");
		String EmployeeName = request.getParameter("EmployeeName");	
		String EmpNo = request.getParameter("EmpNo");	
		String CompanyName = request.getParameter("CompanyName");	
		String ContactNo = request.getParameter("ContactNo");
		String EmailID = request.getParameter("EmailID");	
		String DateOfRegistration = request.getParameter("DateOfRegistration");
		String Cost = request.getParameter("Cost");	
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:JobPortal","root",""); */

			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Insert into employregistration values('"+userid+"','"+password+"','"+EmployeeName+"','"+EmpNo+"','"+CompanyName+"','"+ContactNo+"','"+EmailID+"','"+DateOfRegistration+"','"+Cost+"')";
			System.out.println(Query);
			int result = stmt.executeUpdate(Query);
			if( result > 0)	{
			int auth=2;
			stmt1 =  con.createStatement();
	
			String Query1 = "Insert into login values('"+userid+"','"+password+"',"+auth+")";
			System.out.println(Query1);
			int result1 = stmt.executeUpdate(Query1);
				%><h3 align=center>Inserted into database sucessfully</h3><%
			}
			else{
				%><h3 align=center>Error in updating..please try again</h3><% 
			}
			stmt.close();
			con.close();
		}catch(Exception e){
			stmt.close();
			con.close();
			%><%=e%><%
		}
	
%>
</BODY>


